package com.usian.job;

import com.usian.service.GoodService;
import com.usian.service.GoodsScanService;
import com.xxl.job.core.biz.model.ReturnT;
import com.xxl.job.core.handler.annotation.XxlJob;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import java.util.List;

@Component
public class WeMediaNewsAutoScanJob {

    @Autowired
    private GoodService goodService;

    @Autowired
    private GoodsScanService goodsScanService;

    @XxlJob("myjob")
    public ReturnT<String> myjob(String param){
        List<Integer> release = goodService.findRelease();
        if (release.size()>0){
            for (Integer id : release){
                goodsScanService.autoScanByMediaNewsId(id);
            }
        }
        return ReturnT.SUCCESS;
    }
}
